package main.com.hushengjin.factory;

import main.com.hushengjin.model.Color;
import main.com.hushengjin.model.Shape;
import main.com.hushengjin.model.impl.color.Blue;
import main.com.hushengjin.model.impl.color.Green;
import main.com.hushengjin.model.impl.color.Red;

public class ColorFactory extends AbstractFactory {
    @Override
    public Color getColor(String colorType) {
        if (colorType == null || colorType.trim().length() < 1)
            throw new IllegalArgumentException("传入参数不合法：" + colorType);
        colorType = colorType.toUpperCase();
        Color color;
        switch (colorType) {
            case "RED":
                color = new Red();
                break;
            case "GREEN":
                color = new Green();
                break;
            case "BLUE":
                color = new Blue();
                break;
            default:
                throw new IllegalArgumentException("传入参数不合法：" + colorType);
        }
        return color;
    }

    @Override
    public Shape getShape(String shape) {
        return null;
    }
}
